import com.stein.ProducerApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = ProducerApplication.class)
public class DirectProducerDemo {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Test
    public void directProducer1(){
        rabbitTemplate.convertAndSend("direct_exchange","error","这是一个error级别的direct消息！！");
        rabbitTemplate.convertAndSend("direct_exchange","warning","这是一个warning级别的direct消息！！");
    }

    @Test
    public void directProducer2(){
        rabbitTemplate.convertAndSend("simple_queue","这是一个simple级别的简单消息！！");
    }
}
